package com.ruoyi.tb.lmt.mapper;

import com.ruoyi.tb.lmt.domain.TbRepairplanlist;
import com.ruoyi.tb.lmt.domain.bo.TbRepairplanlistBo;
import com.ruoyi.tb.lmt.domain.vo.TbRepairplanlistVo;
import com.ruoyi.common.core.mapper.BaseMapperPlus;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.time.LocalDate;
import java.util.List;
import java.util.Map;

/**
 * 计划明细Mapper接口
 *
 * @author ruoyi
 * @date 2023-12-07
 */
@Mapper
public interface TbRepairplanlistMapper extends BaseMapperPlus<TbRepairplanlistMapper, TbRepairplanlist, TbRepairplanlistVo> {

    int deleteBatchByPids(List<Long> pids);

    List<TbRepairplanlistVo> selectVoPageLeftJoinPlan(TbRepairplanlistBo bo);

    List<TbRepairplanlistVo> todoList(TbRepairplanlistBo bo);

    List<TbRepairplanlistVo> selectStartList(@Param("planName") String planName,@Param("workGroup") String workGroup);

    List<TbRepairplanlistVo> selectSecondList(@Param("planName") String planName,@Param("workGroup") String workGroup);

    List<TbRepairplanlistVo> selectStartListById(Long id);

    List<TbRepairplanlistVo> selectOverhaulList(@Param("planName") String planName,@Param("workGroup") String workGroup);

    List<TbRepairplanlistVo> selectLegacyList(@Param("planName") String planName,@Param("workGroup") String workGroup);

    List<TbRepairplanlistVo> selectCheckList(@Param("planName") String planName,@Param("workGroup") String workGroup);

    List<TbRepairplanlistVo> selectApprovalList(@Param("planName") String planName,@Param("workGroup") String workGroup);

    List<TbRepairplanlistVo> selectLocomotiveList(@Param("lmtType") String lmtType, @Param("lmtNumber") String lmtNumber , @Param("workerTeam")String workerTeam, @Param("planCode") String planCode, @Param("planName") String planName,@Param("repairChar") String repairChar, @Param("repairStartDate") String repairStartDate, @Param("repairEndDate") String repairEndDate);


    //根据车型车号查询任务id
    Long selectPlanId(@Param("lmtType") String lmtType,@Param("lmtNumber") String lmtNumber);

    Long selectLmtId(@Param("lmtType") String lmtType,@Param("lmtNumber") String lmtNumber);

    List<TbRepairplanlistVo> selectMutualList();

    List<TbRepairplanlistVo> selectSpecialList();

    String selectByLmtId(Long lmtRepairId);

    List<TbRepairplanlistVo> selectAcceptanceList();

    List<TbRepairplanlistVo> selectHistoryDetailList(@Param("lmtType") String lmtType,@Param("lmtNumber") String lmtNumber);

    Boolean isTypeById(@Param("id")Long id);

    TbRepairplanlist selectPlanById(@Param("id") Long id);

    List<TbRepairplanlistVo> selectWorkList(Long lmtRepairId);

    TbRepairplanlist selectPlanInfo(@Param("lmtRepairId") Long lmtRepairId);

    Integer selectOverhaulCount(@Param("repairType") String repairType, @Param("repairStartDate") String repairStartDate, @Param("repairEndDate") String repairEndDate);

    Integer selectPreplannedCount(@Param("repairType") String repairType,@Param("repairStartDate") String repairStartDate, @Param("repairEndDate") String repairEndDate);

    Integer selectFinishedCount(@Param("repairType") String repairType,@Param("repairStartDate") String repairStartDate, @Param("repairEndDate") String repairEndDate);

    Integer selectCancelledCount(@Param("repairType") String repairType,@Param("repairStartDate") String repairStartDate, @Param("repairEndDate") String repairEndDate);

    List<TbRepairplanlistVo> selectListById(Long id);

    Integer selectLmtFinish(Long planId);

    String selectLmtNotFinish(Long planId);

    String selectLmtNotStart(Long planId);

    Integer selectLmtNumberCount(Long planId);

    String selectLmtTypeCount(Long planId);

    List<Map<String, Object>> selectDailyOverhaulCount(@Param("repairType") String repairType, @Param("repairStartDate") String repairStartDate, @Param("repairEndDate") String repairEndDate);
    List<Map<String, Object>> selectDailyPreplannedCount(@Param("repairType") String repairType, @Param("repairStartDate") String repairStartDate, @Param("repairEndDate") String repairEndDate);
    List<Map<String, Object>> selectDailyFinishedCount(@Param("repairType") String repairType, @Param("repairStartDate") String repairStartDate, @Param("repairEndDate") String repairEndDate);
    List<Map<String, Object>> selectDailyCancelledCount(@Param("repairType") String repairType, @Param("repairStartDate") String repairStartDate, @Param("repairEndDate") String repairEndDate);

    int selectLmtOverhaulCount(@Param("planId") Long planId, @Param("startDate") String startDate, @Param("endDate") String endDate);

    int selectLmtAllCount(@Param("planId") Long planId, @Param("startDate") String startDate, @Param("endDate") String endDate);

    boolean isTwoTypeById(@Param("id")Long id);

    List<TbRepairplanlistVo> selectLocomotiveList1(@Param("lmtType") String lmtType, @Param("lmtNumber") String lmtNumber,
                                                   @Param("workerTeam") String workerTeam, @Param("planCode") String planCode,
                                                   @Param("planName") String planName, @Param("repairChar") String repairChar,
                                                   @Param("repairStartDate") String repairStartDate, @Param("repairEndDate") String repairEndDate,
                                                   @Param("status") String status);

    int selectDailyPreplannedCount1(@Param("planId") Long planId,@Param("repairType") String repairType, @Param("date") LocalDate date);

    int selectDailyFinishedCount1(@Param("planId") Long planId,@Param("repairType") String repairType, @Param("date") LocalDate date);

    int selectDailyPreplannedCountToWeek(@Param("repairType") String repairType, @Param("now") LocalDate now);

    int selectDailyFinishedCountToWeek(@Param("repairType") String repairType, @Param("now") LocalDate now);

    int selectDailyOverhaulCount1(@Param("planId") Long planId, @Param("repairType") String repairType, @Param("date") LocalDate date);

    int selectDailyCancelledCount1(@Param("planId") Long planId,@Param("repairType") String repairType, @Param("date") LocalDate date);

    int selectDailyPreplannedCountToWeek1(@Param("planId") Long planId);

    int selectDailyFinishedCountToWeek1(@Param("planId") Long planId, @Param("now") LocalDate now);

    int selectDailyPreplannedCount2(@Param("planId") Long planId, @Param("date") LocalDate date);

    Object selectDailyFinishedCount2(@Param("planId") Long planId, @Param("date") LocalDate date);

    List<Long> selectIdsByType(@Param("lmtType") String lmtType, @Param("repairType") String repairType);

    int selectDailyFinishedCountToWeek2(@Param("planId") Long planId, @Param("now") LocalDate now);

    int selectActualCount(Long planId);

    Integer selectRepairCount(Long planId);

    int selectToRepairCount(Long planId);
}
